# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=xspy
pkgver=1.0c
pkgrel=6
groups=('blackarch' 'blackarch-keylogger')
pkgdesc='A utility for monitoring keypresses on remote X servers.'
arch=('x86_64' 'aarch64')
url='http://www.freshports.org/security/xspy/'
license=('GPL')
depends=('libx11')
makedepends=('imake')
source=("ftp://ftp.fi.freebsd.org/pub/FreeBSD/ports/distfiles/$pkgname-$pkgver.tar.gz")
sha512sums=('c2e14668263ec37782f84bc94d5ed41cb81d5bedeea273dc69d357faf9a4fc374f8faf96f4e40d3a3643619b2dfa4f03de8f2cb1679ff1423b59e878e290d308')

prepare() {
  cd $pkgname

  sed -i '1i\#include <stdlib.h>' "$pkgname.c" usleep.c
}

build() {
  cd $pkgname

  gcc -lX11 -s support.c usleep.c "$pkgname.c" -o $pkgname
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 755 -t "$pkgdir/usr/share/doc/$pkgname/" README
}

